#include "stdafx.h"
#include "StringBad.h"
#include <string>

int StringBad::num_strings=0;

StringBad::StringBad(void)
{
	len = 4;
	str=new char[len];
	strcpy(str,"C++");
	num_strings ++;
	cout << num_strings <<":\""  <<str
		<<"\" object created\n";
}


StringBad::~StringBad(void)
{
	cout << "\""  <<str
		<<"\" object deleted\n";
}

StringBad::StringBad(const char *c){
	len = strlen(c);
	str = new char[len+1];
	strcpy(str,c);
	num_strings ++;
	cout << num_strings <<":\""  <<str
		<<"\" object created\n";
}

ostream& operator<< (ostream &os,const StringBad &st){
	os << st.str;
	return os;
}